SMTP/POP3 Email Engine Library for Delphi (SEE4D) REFERENCE MANUAL Version 3.0 April 19, 1999 This software is provided as-is. There are no warranties, expressed or implied. Copyright (C) 1999 All rights reserved MarshallSoft Computing, Inc. Post Office Box 4543 Huntsville AL 35815 Voice : 256-881-4630 FAX : 256-880-0925 email : info@marshallsoft.com web : www.marshallsoft.com _______ ____|__ | (R) --+ | +------------------- | ____|__ | Association of | | |_| Shareware |__| o | Professionals --+--+ | +--------------------- |___|___| MEMBER MARSHALLSOFT is a registered trademark of MarshallSoft Computing. SEE4D Reference Manual Page 1 C O N T E N T S Chapter Page Table of Contents.............................2 General Remarks...............................3 SEE Functions.................................3 seAttach...................................3 seeClose...................................4 seeDebug...................................5 seeDecodeBuffer............................6 seeDeleteEmail.............................7 seeDriver..................................8 seeEncodeBuffer............................9 seeErrorText..............................10 seeExtractText............................11 seeGetEmailCount..........................12 seeGetEmailFile...........................13 seeGetEmailLines..........................14 seeGetEmailSize...........................15 seeGetEmailUID............................16 seeIntegerParam...........................17 seePop3Connect............................19 seeRelease................................20 seeSendEmail..............................21 seeSmtpConnect............................22 seeStatistics.............................23 seeStringParam............................24 seeVerifyFormat...........................25 seeVerifyUser.............................26 SEE4D Reference Manual Page 2 General Remarks All functions return an integer code. Negative values are always errors. See section 11.3 "SEE Error Return Code List" in the SEE/POP3 Users Manual (SEE4D_U.TXT). Non-negative return codes are never errors. SEE functions +-----------+-------------------------------------------------------+ | seeAttach | Attach SMTP/POP3 Email Engine. | +-----------+-------------------------------------------------------+ SYNTAX function seeAttach( NbrChans : Integer; {Number of channels or threads} KeyCode : LongInt) {Key code value} : Integer REMARKS The seeAttach function must be the first SEE call made. Pass the maximum number of channels or threads that will be in use. Use NbrChans = 1 for non-threaded applications. The 'Chan' parameter for subsequent calls to SEE functions must be in the range of 0 to NbrChans-1. In WIN32, up to 128 threads (numbered from 0 to 127) can be started, each of which can be connected to a different server and run independently. When SEE is registered, you will receive a 'KeyCode' which matches the 'KeyCode' (file KEYCODE.PAS) within the registered DLL. For the shareware version, the keycode is 0. RETURNS < 0 : An error has occurred. See the error list. EXAMPLE {attach for use with non-threaded application} Code := seeAttach(1, SEE_KEY_CODE) ALSO SEE seeSmtpConnect and seePop3Connect. SEE4D Reference Manual Page 3 +----------+--------------------------------------------------------+ | seeClose | Closes SMTP/POP3 Email Engine. | +----------+--------------------------------------------------------+ SYNTAX function seeClose( Chan : Integer) {channel} : Integer; REMARKS The seeClose function closes the connection created by calling seeSmtpConnect or seePop3Connect. seeSmtpConnect or seePop3Connect can be called again to open a connection to another SMTP or POP3 server if desired. SEE can not be connected to both the SMTP server and the POP3 server at the same time. Call seeClose to terminate one connection before connecting again. RETURNS < 0 : An error has occurred. See the error list. EXAMPLE {connect to SMTP server} Code := seeSmtpConnect(0, ...); {send email with seeSendEmail} . . . {close connection to SMTP server} Code := seeClose(0) {connect to POP3 server} Code := seePop3Connect(0, ...) {check/read/delete our email as needed} . . . {close connection to POP3 server} Code := seeClose(0) ALSO SEE seeSmtpConnect and seePop3Connect. SEE4D Reference Manual Page 4 +----------+--------------------------------------------------------+ | seeDebug | Returns debug information. | +----------+--------------------------------------------------------+ SYNTAX Declare function seeDebug( Chan : Integer) {channel} Index : Integer; {Command index} Buffer : PChar; {Buffer to place text into} BufLen : Integer) {Length 'Buffer'} : Integer; REMARKS The seeDebug function returns debug information depending on the value of Index. SEE_GET_REGISTRATION : Gets the registration string. SEE_GET_LAST_RESPONSE : Gets last server response. SEE_GET_SERVER_IP : Gets server IP address in "dotted" notation. RETURNS Length of text placed into 'Buffer'. EXAMPLE Ptr : PChar; Text : String; {get server IP address (after connecting)} GetMem(Ptr, 120); Code := seeDebug(0, SEE_GET_SERVER_IP, Ptr, 120); {convert to Pascal string} Text := StrPas(Ptr); FreeMem(Ptr,120); {display IP address} DisplayLine(Memo, Text); ALSO SEE seeStatistics. SEE4D Reference Manual Page 5 +-----------------+-------------------------------------------------+ | seeDecodeBuffer | Decodes buffer using BASE64. | +-----------------+-------------------------------------------------+ SYNTAX Declare function seeDecodeBuffer( Coded : PChar; {Buffer of BASE64 coded chars} Clear : PChar; {Buffer to put decoded bytes} Size : Integer) {Length of 'Coded' buffer} : Integer; REMARKS The seeDecodeBuffer function decodes the buffer 'Coded' of length 'Size' into 'Clear', returning the length of 'Clear'. The buffer 'Coded' MUST contain BASE64 encoded text, as created by seeEncodeBuffer. The buffer 'Clear' will contain the ASCII or binary data that was encoded. RETURNS Number of bytes placed in 'Clear'. EXAMPLE ClearBuffOne : PChar; ClearBuffTwo : PChar; CodedBuff : PChar; BuffLength : Integer; GetMem(ClearBuffOne, 30); GetMem(ClearBuffTwo, 30); GetMem(CodedBuff, 40); StrPCopy(ClearBuff,'SEE/POP3 Test'); BufLength := Length(StrPas(ClearBuff)); {BASE64 encode} BufLength := seeEncodeBuffer(ClearBuffOne, CodedBuff, BufLength); {BASE64 decode} BufLength := seeDecodeBuffer(CodedBuff, ClearBuffTwo, BufLength); {ClearBuffTwo should have same text as ClearBuffOne} ALSO SEE seeEncodeBuffer. SEE4D Reference Manual Page 6 +----------------+--------------------------------------------------+ | seeDeleteEmail | Deletes email from Server. | +----------------+--------------------------------------------------+ SYNTAX function seeDeleteEmail( Chan : Integer; {Channel} MsgNbr : Integer) {message number} : Integer; REMARKS The seeDeleteEmail function deletes the email numbered 'MsgNbr' from the server. Be careful! Once an email has been deleted from the server, it cannot be recovered. RETURNS < 0 : An error has occurred. See the error list. EXAMPLE var Code : Integer; begin . . . {delete message # 5 , # 6, and #7} Code := seeDeleteEmail(0, 5); if Code >= 0 then Code := seeDeleteEmail(6); if Code >= 0 then Code := seeDeleteEmail(7); . . . ALSO SEE seeGetEmailCount. SEE4D Reference Manual Page 7 +-----------+-------------------------------------------------------+ | seeDriver | Executes next SEE state. | +-----------+-------------------------------------------------------+ SYNTAX function seeDriver( Chan : Integer) {Channel} : Integer; REMARKS The seeDriver function executes the next state in the SEE state engine. The purpose of this function is to allow the programmer to get control after the driver executes each SEE state. The seeDriver function is explicitly called only after the AUTO_DRIVER_CALL flag has been disabled (see function seeIntegerParam). If the AUTO_DRIVER_CALL flag has not been disabled (the default), then seeDriver does not need to be called. Refer to the section 4.0 "Theory of Operation" in the SMTP/POP3 Users Manual for more details on the operation of seeDriver. RETURNS = 0 : The driver is done. < 0 : An error has occurred. See the error list. > 0 : The returned value is the state just executed. EXAMPLE var Code : Integer; . . . Code := seeSmtpConnect(0, ...); . . . {disable automatic calling of seeDriver} Code := seeIntegerParam(0, AUTO_DRIVER_CALL, 0); Code := seeSendEmail(0, ...); If Code < 0 Then begin ...handle error exit end; Repeat Code := seeDriver(0); If Code < 0 Then begin ...handle error exit end; {do something here . . } Until Code = 0; ALSO SEE seeIntegerParam, seeSmtpConnect, and seePop3Connect. SEE4D Reference Manual Page 8 +-----------------+-------------------------------------------------+ | seeEncodeBuffer | Encodes buffer using BASE64. | +-----------------+-------------------------------------------------+ SYNTAX Declare function seeEncodeBuffer( Clear : PChar; {Buffer to put decoded bytes} Coded : PChar; {Buffer to put BASE64 encoded} Size : Integer) {Length of 'Clear' buffer} : Integer; REMARKS The seeEncodeBuffer function encodes 'Clear' into 'Coded' using Base-64 encoding. The 'Clear' buffer may contain any ASCII or binary data. The 'Coded' buffer will contain 7-bit ASCII data broken into lines of 76 characters followed by a carriage return Chr$(13) and line feed Chr$(10). That is, 'Coded' will contains multiple lines. RETURNS Number of bytes placed in 'Coded'. EXAMPLE ClearBuffOne : PChar; ClearBuffTwo : PChar; CodedBuff : PChar; BuffLength : Integer; GetMem(ClearBuffOne, 30); GetMem(ClearBuffTwo, 30); GetMem(CodedBuff, 40); StrPCopy(ClearBuff,'SEE/POP3 Test'); BufLength := Length(ClearBuff); {BASE64 encode} BufLength := seeEncodeBuffer(ClearBuffOne, CodedBuff, BufLength); {BASE64 decode} BufLength := seeDecodeBuffer(CodedBuff, ClearBuffTwo, BufLength); {ClearBuffTwo should have same text as ClearBuffOne} ALSO SEE seeIntegerParam, seeSmtpConnect, and seePop3Connect. SEE4D Reference Manual Page 9 +--------------+----------------------------------------------------+ | seeErrorText | Get text associated with error code. | +--------------+----------------------------------------------------+ SYNTAX function seeErrorText( Chan : Integer; {Channel} Code : Integer; {Error code returned by SEE} Buffer : PChar; {Buffer to place error text} BufLen : Integer) {Length of above Buffer} : Integer; REMARKS The seeErrorText function is used to get the error text associated with an an error code as returned by one of the SEE library functions. When an error occurs, seeErrorText can be used to get the error text so that it can be displayed for the user. RETURNS Number of bytes placed in 'Buffer'. EXAMPLE var Buffer : PChar; Code : Integer; begin Code := seeSmtpConnect(0, ...); If Code < 0 Then begin {error detected} GetMem(Buffer, 64); Code := seeErrorText(0, Code, Buffer, 64); ... end; ... ALSO SEE ERRORS.TXT. SEE4D Reference Manual Page 10 +----------------+--------------------------------------------------+ | seeExtractText | Extract specified text from buffer. | +----------------+--------------------------------------------------+ SYNTAX function seeExtractText( Source : Integer; {Text buffer to search} Text : PChar; {Text searching for} Buffer : PChar; {Buffer for line if found} BufSize : Integer) {Size of 'Buffer'} : Integer; REMARKS The seeExtractText function is used to search the text buffer 'Source' for text 'Text'. If found, the entire line is copied to 'Buffer', up to a maximum of 'BufSize' bytes. The primary purpose of seeExtractText is to extract header lines from the buffer after calling seeGetEmailLines. The seeExtractText does not require a connection to a SMTP or POP3 server. For an example of use, see the STATUS sample program. RETURNS Number of bytes placed in 'Buffer'. EXAMPLE var Source : PChar; From : PChar; Temp : PChar; begin ... {search 'Source' for the line containing 'From:'} GetMem(Temp, 80); GetMem(From, 8}; StrPCopy(From,'From: '); Code := seeExtractText(Source, From, Temp, 80); {print line if found} If Code > 0 Then begin ... end; ALSO SEE seeGetEmailLines. SEE4D Reference Manual Page 11 +------------------+------------------------------------------------+ | seeGetEmailCount | Get number of email messages on server. | +------------------+------------------------------------------------+ SYNTAX function seeGetEmailCount( Chan : Integer) {Channel} : Integer; REMARKS The seeGetEmailCount function returns the number of messages waiting on the server, independent of whether they have been previously read. If you have disabled the driver AUTO_CALL capability, the message count must be found by Count := seeStatistics(Chan, SEE_GET_MSG_COUNT); after calling seeDriver until it returns 0. Refer to the STATUS sample program for an example of use. RETURNS < 0 : An error has occurred. See the error list >=0 : The number of email messages waiting (if AUTO_CALL was disabled). EXAMPLE {connect to POP3 server} Code := seePop3Connect(0, ...); {get # messages waiting} Code := seeGetEmailCount(0); ... 'Code' messages waiting. ALSO SEE seeGetEmailLines. SEE4D Reference Manual Page 12 +-----------------+-------------------------------------------------+ | seeGetEmailFile | Read email message & save to a file. | +-----------------+-------------------------------------------------+ SYNTAX function seeGetEmailFile( Chan : Integer; {Channel} MsgNbr : Integer; {header #} EmailName : PChar; {email filename} EmailDir : PChar; {directory for email} AttachDir : PChar) {directory for attachments} : Integer; REMARKS The seeGetEmailFile reads the email message 'MsgNbr', saving it to disk as filename 'EmailName' in directory 'EmailDir', and saving MIME attachments to directory 'AttachDir'. Be sure that the specified directories exist before calling this function. Use '.' to specify the current directory. Also note that a older file of the same name as being saved will be overwritten by the newer file. RETURNS < 0 : An error has occurred. See the error list EXAMPLE var MsgPtr : PChar; DirPtr : PChar; begin {read message 1 and save as MYMAIL.TXT} GetMem(MsgPtr,32); StrPCopy(MsgPtr,'mymail.txt'); GetMem(DirPtr,32); StrPCopy(DirPtr,'.'); Code := seeGetEmailFile(0, 1, MsgPtr, DirPtr, DirPtr) FreeMem(MsgPtr); FreeMem(DirPtr); If Code < 0 Then begin ... handle error code end; ALSO SEE seeGetEmailLines. SEE4D Reference Manual Page 13 +------------------+------------------------------------------------+ | seeGetEmailLines | Read lines from email message. | +------------------+------------------------------------------------+ SYNTAX function seeGetEmailLines( Chan : Integer; {Channel} MsgNbr : Integer; {message #} Lines : Integer; {# lines} Buffer : Integer; {buffer for email} Size : Integer) {size of buffer} : Integer; REMARKS The seeGetEmailLines function reads all header lines plus the number of body lines specified by the 'Lines' argument into 'Buffer', up to a maximum of 'Size' bytes. The primary purpose of this function is to read the header lines without having to read the entire message. If you have disabled the driver AUTO_CALL capability, the size must be found by Count := seeStatistics(Chan, SEE_GET_BUFFER_COUNT); after calling seeDriver until it returns 0. See the STATUS sample code for an example of use. RETURNS < 0 : An error has occurred. See the error list. >=0 : The number of bytes read (if AUTO_CALL was disabled). EXAMPLE var Buffer : PChar; begin {read header lines for email # 1} GetMem(Buffer, 1024); Code := seeGetEmailLines(0,1,0,Buffer,1024); {text is in string StrPas(Buffer)} ... ALSO SEE seeGetEmailFile SEE4D Reference Manual Page 14 +-----------------+-------------------------------------------------+ | seeGetEmailSize | Get size of email message in bytes. | +-----------------+-------------------------------------------------+ SYNTAX function seeGetEmailSize( Chan : Integer; {Channel} MsgNbr : Integer) {message number} : LongInt; REMARKS The seeGetEmailSize function returns the size in bytes of the specified message # 'MsgNbr'. seeGetEmailSize returns the size of the entire email message, including any attachments. Note that attachments will be encoded (MIME, UUENCODE, etc.), and thus take up more room than after they are decoded. If you have disabled the driver AUTO_CALL capability, the size must be found by Size = seeStatistics(Chan,SEE_GET_MSG_SIZE); after calling seeDriver until it returns 0. See the READER sample code for an example of use. RETURNS < 0 : An error has occurred. See the error list >=0 : The size of the email in bytes on the server (if AUTO_CALL was disabled). EXAMPLE var FileSize : LongInt; begin {get size of email message # 3} FileSize := seeGetEmailSize(0, 3); ... ALSO SEE seeGetEmailCount. SEE4D Reference Manual Page 15 +----------------+--------------------------------------------------+ | seeGetEmailUID | Get user ID from the server. | +----------------+--------------------------------------------------+ SYNTAX function seeGetEmailUID( Chan : Integer; {Channel} MsgNbr : LongInt; { message (-1 for all) # String : PChar; {Pointer to Buffer} BufLen : LongInt) {size of buffer} : Integer; REMARKS The seeGetEmailUID function is used to ask the POP3 server for the unique user ID string for a particular email message, or for all email messages on the server. The UID string is always the same for a particular email message, regardless of the email message number. Most POP3 servers can provide such a unique ID string. A few POP3 servers do not provide ID strings. RETURNS < 0 : An error has occurred. See the error list >=0 : The number of bytes in moved into 'Buffer'. (if AUTO_CALL was disabled). EXAMPLE var Buffer : PChar; begin {read UID for email message # 1} GetMem(Buffer, 1024); Code := seeGetEmailUID(0,1,Buffer,1024); {text is in string StrPas(Buffer)} ... ALSO SEE seeGetEmailCount. SEE4D Reference Manual Page 16 +-----------------+-------------------------------------------------+ | seeIntegerParam | Sets SEE integer parameter. | +-----------------+-------------------------------------------------+ SYNTAX function seeIntegerParam( Chan : Integer; {Channel} ParmIndex : Integer; {Parameter index (see below)} ParmValue : Integer) {Value of parameter to set} : Integer; REMARKS The seeIntegerParam is used to set an integer parameter which controls the operation of SEE4D. Time values are always specified in milliseconds. Pass 1 for TRUE (or YES) and 0 for FALSE (or NO). Default values are as follows: Parameter Name Default SEE_MIN_RESPONSE_WAIT : 100 SEE_MAX_RESPONSE_WAIT : 25000 SEE_MIN_LINE_WAIT : 0 SEE_MAX_LINE_WAIT : 25000 SEE_CONNECT_WAIT : 60000 SEE_QUOTED_PRINTABLE : 0 SEE_AUTO_CALL_DRIVER : 1 SEE_FILE_PREFIX : 0 SEE_SLEEP_TIME : 50 SEE_MIN_RESPONSE_WAIT is the delay before looking for the server's response. SEE_MAX_RESPONSE_WAIT is the time after which a "time-out" error occurs if the server has not responded. SEE_MIN_LINE_WAIT is the delay before checking if the server is ready to accept the next line of input. SEE_MAX_LINE_WAIT is the time after which a "time-out" error is declared if the server has not responded. SEE_CONNECT_WAIT is the maximum time allowed to complete a connection to the SMTP server. (continued on next page) SEE4D Reference Manual Page 17 SEE_QUOTED_PRINTABLE controls whether messages are (1) or are not (0) encoded as quoted-printable. Incoming messages that are quoted are always converted regardless of the state of this feature. SEE_AUTO_CALL_DRIVER controls whether seeDriver is called automatically (to completion) after seeSmtpConnect or seePop3Connect has been called. Refer to the Users manual for more details on the operation of seeDriver. SEE_SLEEP_TIME is the time SEE sleeps when waiting on a winsock. SEE_FILE_PREFIX controls whether "1-", "2-", etc. is prefixed to the filename of each attachment. If two attachments are named FILEONE.ZIP and FILETWO.ZIP, they will be saved as 1-FILEONE.ZIP and 2-FILETWO.ZIP. Note that Windows 3.1 may truncate long filenames. This feature should always be used unless you are downloading to a directory specifically for downloaded attachments. EXAMPLE {enable quoting} seeIntegerParam(0,SEE_QUOTED_PRINTABLE, 1); {disable auto call feature} seeIntegerParam(0,SEE_AUTO_CALL_DRIVER, 0); {enable attachment file prefixes} seeIntegerParam(0,SEE_FILE_PREFIX, 1); {set maximum response wait to 45 seconds} seeIntegerParam(0,SEE_MAX_RESPONSE_WAIT, 45000); ALSO SEE seeStringParam. SEE4D Reference Manual Page 18 +----------------+--------------------------------------------------+ | seePop3Connect | Connects to POP3 Server. | +----------------+--------------------------------------------------+ SYNTAX function seePop3Connect( Chan : Integer; {Channel} Pop3Ptr : PChar; {Pop3 server name} UserPtr : PChar; {POP3 user name} PassPtr : PChar) {POP3 password} : Integer; REMARKS The seePop3Connect function establishes a connection with the POP3 server as specified by the Server argument. Your POP3 server name will typically be named "mail.XXX.com" where XXX is your email address, such as name@XXX.com. Your POP3 server name can also be found in the setup information for your normal email client, such as Eudora or Microsoft Outlook. The POP3 server name can also be specified in dotted decimal notation if wanted. For example "10.23.231.1". SEE can not be connected to both the SMTP server and the POP3 server at the same time on the same channel. Call seeClose to terminate one connection before connecting again. Refer to the SEE4D Users Manual for more information. RETURNS < 0 : An error has occurred. See the error list. EXAMPLE var Code : Integer; HostPtr : PChar; {POP3 server} UserPtr : PChar; {User} PassPtr : PChar; {password} begin GetMem(HostPtr,64); StrPCopy(HostPtr,'mail.myisp.com'); GetMem(UserPtr,64); StrPCopy(UserPtr,'billbob'); GetMem(PassPtr,64); StrPCopy(PassPtr,'mypassword'); Code := seePop3Connect(0, HostPtr, UserPtr, PassPtr); ... ALSO SEE seeSmtpConnect and seeClose. SEE4D Reference Manual Page 19 +------------+------------------------------------------------------+ | seeRelease | Releases SEE. | +------------+------------------------------------------------------+ SYNTAX function seeRelease : Integer; REMARKS The seeRelease function releases the SEE system. This should be the very last function called. seeClose should be called for all channels before calling seeRelease. RETURNS < 0 : An error has occurred. Call seeErrorText. EXAMPLE ' Initialize SEE for one channel (# 0). Code := seeAttach(1, SEE_KEY_CODE); ' ' call any SEE function except seeAttach and seeRelease. ' ' close channel 0 Code := seeClose(0); ' Terminate SEE Code := seeRelease(); ALSO SEE seeAttach. SEE4D Reference Manual Page 20 +--------------+----------------------------------------------------+ | seeSendEmail | Sends email and attachments. | +--------------+----------------------------------------------------+ SYNTAX function seeSendEmail( Chan : Integer; {Channel} To : PChar; {Recipient, separated by commas} CC : PChar; {CC list, separated by commas} BCC : PChar; {BCC list, separated by commas} Subj : PChar; {Subject text} Msg : PChar; {Message or message filename} Attach : PChar) {File attachment} : Integer; REMARKS The seeSendEmail function is used to send email once a connection has been made to your SMTP server after calling seeSmtpConnect. Note that all email addresses (in To, CC, and BCC strings) must be bracketed. For example: "Mike M " The CC and BCC strings may contain multiple email addresses, separated by commas. For example: "Billy Bob,Buster" If the first character of the message (fifth argument) is a '@', then it is considered as the filename which contains the message to send. 'Attach' may contain one or more attachments, separated by commas. For example, "file1.zip,file2.doc". RETURNS < 0 : An error has occurred. See the error list. EXAMPLE var NullP : PChar; {empty string} ToPtr : PChar; {receipient} SubjPtr : PChar; {subject} MsgPtr : PChar; {message} begin GetMem(NullP,4); StrPCopy(NullP,''); GetMem(ToPtr,64); StrPCopy(ToPtr,'' brackets, such as "Mike M". The 'ReplyTo' string is optional and is used for the 'Reply-To:' header line. If used, the email address must be enclosed in '<>' brackets. SEE can not be connected to both the SMTP server and the POP3 server at the same time. Call seeClose to terminate one connection before connecting again. RETURNS < 0 : An error has occurred. See the error list. EXAMPLE var NullPtr : PChar; {empty string} HostPtr : PChar; {SMTP host} FromPtr : PChar; {my email address} begin GetMem(NullPtr,4); StrPCopy(NullPtr,''); GetMem(HostPtr,64); StrPCopy(HostPtr,'mail.myisp.com'); GetMem(From,64); StrPCopy(FromPtr,''); seeSmtpConnect(0,HostPtr, FromPtr, NullPtr); ... ALSO SEE seeClose. SEE4D Reference Manual Page 22 +---------------+---------------------------------------------------+ | seeStatistics | Returns runtime statistics. | +---------------+---------------------------------------------------+ SYNTAX function seeStatistics( Chan : Integer; {Channel} Index : Integer) {Specifies which statistic} : Integer; REMARKS The seeStatistics function is used to return runtime statistics in the SEE DLL. The values of 'Index' are defined in SEE16.PAS and SEE32.PAS as follows: SEE_GET_VERSION : Gets the SEE version number. SEE_GET_SOCK_ERROR : Gets last socket error. SEE_GET_COUNTER : Gets # times driver called. SEE_GET_RESPONSE : Gets last SMTP response code. SEE_GET_MESSAGE_BYTES_READ : Gets # message bytes read. SEE_GET_ATTACH_BYTES_READ : Gets # attachment bytes read. SEE_GET_TOTAL_BYTES_READ : Gets total of above two. SEE_GET_MESSAGE_BYTES_SENT : Gets # message bytes sent. SEE_GET_ATTACH_BYTES_SENT : Gets # attachment bytes sent. SEE_GET_TOTAL_BYTES_SENT : Gets total of above two. SEE_GET_MSG_COUNT : Gets # emails waiting. SEE_GET_MSG_SIZE : Gets size of email. SEE_GET_BUFFER_COUNT : Gets # bytes in buffer for seeGetEmailLines. The number of message bytes sent will usually be larger than your message size because of SMTP protocol overhead. The number of attachment bytes sent will be at least one-third larger than the actual attachment since every 3 bytes are encoded as 4 7-bit ASCII bytes before being transmitted. The purpose of "...BYTES_READ" and "...BYTES_SENT" is to provide the ability to track the transmission progress of large messages and attachments. See the READER example program. EXAMPLE {get total message & attachment bytes transmitted} Code := seeStatistics(0,SEE_GET_TOTAL_BYTES_SENT); ALSE SEE seeDriver, seeIntegerParam, and seeStringParam. SEE4D Reference Manual Page 23 +----------------+--------------------------------------------------+ | seeStringParam | Sets SEE string parameter. | +----------------+--------------------------------------------------+ SYNTAX function seeStringParam( Chan : Integer; {Channel} ParamName : Integer; {Index of parameter} ParamString : PChar) {Parameter string} : Integer; REMARKS The seeStringParam function is used to set a string parameter as defined in SEE16.PAS and SEE32.PAS. For more information, refer to the Users Manual. SEE_LOG_FILE : Specifies the log filename. SEE_SET_REPLY : Sets the "Reply To" string. SEE_SET_HEADER : Adds header line(s). The log file is used to debug a SMTP or POP3 session. Be advised that log files can be quite large. Don't use them unless necessary. Use SEE_SET_REPLY to change the "Reply-To:" header after connecting to the server, just before sending an email. Use SEE_SET_HEADER to add one or more header lines. Each header line except the last should end with a carriage return line feed pair. EXAMPLE var LogPtr : PChar; {log file name} ReplyPtr : PChar; {Reply-To address} begin {specify a log file} GetMem(LogPtr,64); StrPCopy(LogPtr,'MYTEST.LOG'); seeStringParam(0,SEE_LOG_FILE, LogPtr); FreeMem(LogPtr, 64); {specify Reply-To address} GetMem(ReplyPtr,64); StrPCopy(ReplyPtr,''); seeStringParam(0,SEE_SET_REPLY, ReplyPtr); FreeMem(ReplyPtr, 64); ... ALSO SEE seeIntegerParam. SEE4D Reference Manual Page 24 +-----------------+-------------------------------------------------+ | seeVerifyFormat | Check email address format. | +-----------------+-------------------------------------------------+ SYNTAX function seeVerifyFormat( Text : PChar) {Email address to check} : Integer; REMARKS The seeVerifyFormat function is used to test an individual email address for proper formatting. If this function returns 0 or above, then the email address is properly formatted. But, if this function returns a negative value, the email address is either badly formatted, or it uses characters (such as '%') that are not normally used as part of an email address. Note that left and right brackets ('<' and '>') must surround the email address. EXAMPLE var EmailAddr : PChar; Buffer : PChar; begin GetMem(Buffer, 80); GetMem(EmailAddr, 32); StrPCopy(EmailAddr,'Billy'); Code := seeVerifyFormat(EmailAddr) If Code < 0 Then begin Code := seeErrorText(0,Code,Buffer,80) {error text is in string StrPas(Buffer) } ... end; FreeMem(Buffer,80); FreeMem(EmailAddr, 32); ALSO SEE seeErrorText. SEE4D Reference Manual Page 25 +---------------+---------------------------------------------------+ | seeVerifyUser | Verify email address. | +---------------+---------------------------------------------------+ SYNTAX function seeVerifyUser( Chan : Integer; {Channel} Text : PChar) {Email address to verify} : Integer; REMARKS The seeVerifyUser function is used to verify an individual email address with the email server which "owns" the email address. seeVerify will connect to the specified server and request verification of the user. Some SMTP servers may refuse connection of any client not directly connected to them or may refuse all "verify user" requests. Web based email servers such as hotmail.com may refuse all SMTP connections. Note that you connect to the remote SMTP server rather than the SMTP server that you use to send email. For example, to verify msc@traveller.com, you must first connect to the SMTP server "mail.traveller.com" then call SeeVerifyUser("msc"). EXAMPLE Code : Integer; SmtpServer : String; User : PChar Buffer : PChar; GetMem(SmtpServer, 32); GetMem(User, 32); GemMem(Buffer,32); StrPCopy(SmtpServer,'mail.traveller.com'); StrPCopy(User,'msc'); Code := seeSmtpConnect(0, SmtpServer, ...); . . . Code := seeVerifyUser(0, UserPtr); If Code = 0 THEN Begin {display last server response} DisplayLine('User is verified'); End Else DisplayLine('User is NOT verified.') End If ALSO SEE seeErrorText and seeDebug. SEE4D Reference Manual Page 26